﻿using System.Reflection;
using System.Threading;
using System.Windows;
using DynamicMVVM.Demo.UI.Utilities;

namespace DynamicMVVM.Demo.UI
{
    /// <summary>
    /// Interaction logic for App.xaml
    /// </summary>
    public partial class App : Application
    {
        private Mutex _singleInstanceMutex;

        protected override void OnStartup(StartupEventArgs e)
        {
            bool isNewCreated;
            _singleInstanceMutex = new Mutex(true, "DemoApplication", out isNewCreated);

            if (!isNewCreated)
            {
                Shutdown();
            }

            TranslationManager.Instance.TranslationProvider = new ResxTranslationProvider("Main", Assembly.GetExecutingAssembly());

            base.OnStartup(e);
        }
    }
}
